<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>HTTP JSON Client Test</title>
  <script type="text/javascript">
    function sendMessage() {
      var xmlhttp = new XMLHttpRequest();
      xmlhttp.open('POST', "", true);
      
      // Manage the response
      xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
          window.document.getElementById("response").innerHTML = xmlhttp.response;
          console.log(xmlhttp.response);
        }
      }
      // Send the POST request
      xmlhttp.setRequestHeader('Content-Type', 'application/json');
      var data = ["setCookies", [{"key":"key1", "value":"cookie1", "expires":360}, {"key":"key2", "value":"cookie2", "expires":120, "path":"/", "domain":"127.0.0.1", "secure":"false", "httponly":"true"}]];
      xmlhttp.send(JSON.stringify(data));
    }
  </script>
</head>
<body>
    <div>
        <input type="button" value="Send" onclick="sendMessage();" />
    </div>
    <h1>Response :</h1>
    <div id="response">
        
    </div>
</body>
</html>